package com.kalua.list.harvester;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.fluent.Request;

public class ContentUtil {
	
	private static final String USER_AGENT_HEADER = "User-Agent";
	private static final String USER_AGENT_VALUE = "KaluaIndexAndSearchBot/1.0 (+https://code.google.com/p/kalua/)";

	public static String getContent(	String url, int timeout) 
														throws 	ClientProtocolException, 
																		IOException {
		return Request.Get(url)
				.setHeader(USER_AGENT_HEADER, USER_AGENT_VALUE)
				.connectTimeout(timeout).socketTimeout(timeout).execute()
				.returnContent().asString();
	}		
}
